Conditionally save FPU context in IRQ, and preserve vApplicationFPUSa…#1429
Open
Loustiic wants to merge 1 commit into
Open
Conditionally save FPU context in IRQ, and preserve vApplicationFPUSa…#1429Loustiic wants to merge 1 commit into
Loustiic wants to merge 1 commit into
Conversation
…feIRQHandler logic
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
On the ARM Cortex A9 port of the FreeRTOS kernel, the FPU is never saved when the application provides an implementation of vApplicationIRQHandler, even though configUSE_TASK_FPU_SUPPORT can be set to 1 or 2.
This is the case with Xilinx's FreeRTOS port for Zynq 7000 (tested on 7020 here).
It is important to save these registers, even if the FPU should never be used in the IRQ handler: memcpy, memset or memcmp might use it -- https://freertos.org/Using-FreeRTOS-on-Cortex-A-Embedded-Processors#important-note-for-gcc-and-possibly-other-compiler-users.
In other words, using stream_buffers, queues or other memory APIs from FreeRTOS leads to FPU corruption when using GCC in an interrupt context.
For this reason, it makes sense to check ulPortTaskHasFPUContext, and save the FPU registers if necessary.
This issue was discussed (on the forum)[https://forums.freertos.org/t/floating-context-not-saved-properly-on-zynq7020/13250] for the Zynq 7020.
The patch is structured as followed:
Checklist:
Related Issue
Two PR for other architecture targeted a similar issue:
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.